def solve(board):
    for i in range(9):
        storage = []
        for j in range(9):
            if board[i][j] == ".":
                continue
            if board[i][j] in storage:
                return False
            storage.append(board[i][j])

    for i in range(9):
        storage = []
        for j in range(9):
            if board[j][i] == ".":
                continue
            if board[j][i] in storage:
                return False
            storage.append(board[j][i])

    for i in range(0, 9, 3):
        for j in range(0, 9, 3):
            storage = []
            for raw in range(i, i + 3):
                for col in range(j, j + 3):
                    if board[raw][col] == ".":
                        continue
                    if board[raw][col] in storage:
                        return False
                    storage.append(board[raw][col])

    return True


if __name__ == "__main__":
    board = [["5", "3", ".", ".", "7", ".", ".", ".", "."]
        , ["6", ".", ".", "1", "9", "5", ".", ".", "."]
        , [".", "9", "8", ".", ".", ".", ".", "6", "."]
        , ["8", ".", ".", ".", "6", ".", ".", ".", "3"]
        , ["4", ".", ".", "8", ".", "3", ".", ".", "1"]
        , ["7", ".", ".", ".", "2", ".", ".", ".", "6"]
        , [".", "6", ".", ".", ".", ".", "2", "8", "."]
        , [".", ".", ".", "4", "1", "9", ".", ".", "5"]
        , [".", ".", ".", ".", "8", ".", ".", "7", "9"]]
    print(solve(board))
